package com.whenJay;

import javax.servlet.*;
import java.io.IOException;

public class myFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("MyFilter");
        Filter.super.init(filterConfig);
    }
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {

        System.out.println("myFilter 正在处理");
        //该方法之前的部分，为预处理的部分
        filterChain.doFilter(servletRequest,servletResponse);
        // 响应给客户端之前的 再处理的部分
        System.out.println("MyFilter 过滤完成！");
    }

    @Override
    public void destroy() {
        System.out.println("myFilter 销毁");
    }


}
